﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Salary
{
    class HourlyWorker : Employee
    {
        public double rate { get; private set; }
        public double hours { get; private set; }

        public HourlyWorker(string name, double rate, double hours) : base(name)
        {
            if (rate <= 0 || hours <= 0)
            {
                throw new Exception("Rate or hours should be grater than 0");
            }
            else
            {
                this.rate = rate;
                this.hours = hours;
            }
        }

        public override void CalculateSalary()
        {
            Console.WriteLine("Name: {0}, Salary: {1}$", name, rate*hours);
        }
    }
}
